package com.ybkj.o2o.mc.service;

import java.util.List;

import com.ybkj.o2o.mc.common.query.DepartmentQuery;
import com.ybkj.o2o.mc.entity.Department;

public interface DepartmentService {

	  /**
	   * 判断部门名称是否存在.
	   *
	   * @param departmentName   部门名称
	   * @param appKey 系统key
	   * @param enterpriseId 
	   * @return true存在, false不存在
	   */
	  Department exists(String name, String appKey, Long enterpriseId);
	  
	  /**
	   * 增加部门
	   * 
	   * @param department
	   */
	  int insert(Department department);

	  /**
	   * 通过参数查询部门
	   * 
	   * @param departmentQuery
	   * @return
	   */
	  List<Department> findByDepartmentQuery(DepartmentQuery departmentQuery);

	  /**
	   * 通过参数查询部门的总数
	   * 
	   * @param departmentQuery
	   * @return
	   */
	  Long countByDepartmentQuery(DepartmentQuery departmentQuery);

	  /**
	   * 通过Id和appKey查询该部门
	   * 
	   * @param id
	   * @param appKey
	   * @return
	   */
	  Department findByIdAndAppKey(Long id, String appKey);
	  
	  /**
	   * 根据id修改部门基本信息.
	   *
	   * @param department 部门信息
	   * @return 受影响行数
	   */
	  int updateByPrimaryKey(Department department);
	  /**
	   * 根据id删除相应部门
	   * 
	   * @param id
	   * @param appKey
	   * @return
	   */
	  int deleteByPrimaryKey(Long id, String appKey);

	  int updateBalance(Department department);

	  /**
	   * 批量删除部门
	   * 
	   * @param departmentIds
	   * @param appKey
	   * @return
	   */
	  int batchDeleteByIds(List<Long> departmentIds, String appKey);

	  int updateEnterpriseNameByEnterpriseId(Long enterpriseId,
			String enterpriseName, String appKey);

	  int updateCompanyName(Long companyId, String abbreviation, String appKey);
	  
}
